﻿using Mathmall.Administration.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Mathmall.Administration.Data
{
    public class CommentReplayEntityTypeConfiguration : IEntityTypeConfiguration<CommentReplay>
    {
        public void Configure(EntityTypeBuilder<CommentReplay> builder)
        {
            // 不使用output子句
            builder.ToTable(table => table.UseSqlOutputClause(false));

            builder
                .ToTable(nameof(CommentReplay))
                .ToTable(tableBuilder => tableBuilder.HasComment("商品评价回复关系"));

            builder
                .HasKey(commentReplay => commentReplay.CommentReplayID)
                .HasName("CommentReplayID");

            builder
                .Property(commentReplay => commentReplay.CommentID)
                .HasColumnName("CommentID")
                .HasColumnType("int")
                .HasComment("评论id")
                .IsRequired(false);

            builder
                .Property(commentReplay => commentReplay.ReplayID)
                .HasColumnName("ReplayID")
                .HasColumnType("int")
                .HasComment("品牌id")
                .IsRequired(false);

            builder
                .Property(commentReplay => commentReplay.CreateTime)
                .HasColumnName("CreateTime")
                .HasColumnType("datetime")
                .HasComment("创建时间")
                .IsRequired(false);

            builder
                .Property(commentReplay => commentReplay.LastUpdateTime)
                .HasColumnName("LastUpdateTime")
                .HasColumnType("datetime")
                .HasComment("最后更新时间")
                .IsRequired(false);
        }
    }
}
